#include <iostream>
#include <thread>
#include <future>
#include <chrono>

int Add(int num1,int num2)
{
    std::cout<<"加法1111\n";
    std::this_thread::sleep_for(std::chrono::seconds(5));
    std::cout<<"加法2222\n";
    return num1+num2;
}
int main()
{
    std::cout<<"-------1--------\n";
    std::future<int> result=std::async(std::launch::deferred,Add,11,22);
    std::cout<<"-------2--------\n";
    std::this_thread::sleep_for(std::chrono::seconds(1));
    int sum=result.get();
    std::cout<<"-------3--------\n";
    std::cout<<sum<<std::endl;
    return 0;
}